Editing Foldit Recipes
Foldit has a built-in recipe editor, but it has extremely limited function. For example, the Foldit recipe editor lacks the search/replace functions found in simple editors like Windows Notepad. Many Foldit LUA recipes are hundreds of lines long. Recipes of this size and complexity require a more full-featured editor. This article describes the process for exporting an existing recipe, modifying the recipe, and importing the modified recipe under a new name. The examples in this article were created under Windows. See also Little Square Boxes (LSB) for a discussion of how to fix and avoid control characters in Foldit recipes. The control characters show up as little square boxes when viewed in the Foldit recipe editor. Quick Summary The steps involved in updating a recipe are illustrated in detail in the sections below. This section provides a quick summary with no illustrations. The first step is to export an existing recipe. #Open the recipe in the Foldit recipe editor #Click "Save As" in the recipe editor toolbar #In the Foldit "Save As" dialog, click "Export" #In the OS-specific "Save As" dialog select a name and location for the recipe file Note: as detailed in the discussion of Little Square Boxes (LSB), if the recipe shows little square boxes at the end of each line in the Foldit recipe editor, it's better to copy the recipe and paste into the editor of your choice. The next step is to edit the recipe with the editor of your choice. After updating the recipe, the final step is to import the modified recipe into Foldit. The recipe can then be tested and shared. The process listed here preserves the parent/child relationship of the old and new versions of the recipe. #Open the existing recipe in the Foldit recipe editor #Click "Save As" in the recipe editor toolbar #In the Foldit "Save As" dialog, change the recipe's name and description, and click "OK" #The existing recipe has now been copied and renamed #With the newly renamed recipe still open in the Foldit recipe editor, click "Load" #In the "Load" dialog, click "Import" #In the OS-specific file open dialog, select the modified recipe file #In the Foldit recipe editor, verify the correct version was imported, and click "Save" #The new version of the recipe is now available in the Foldit cookbook For a completely new recipe, the import process is similar. #In the Foldit recipe editor, click "New (Script V2)" from the toolbar #(You may be prompted to save or discard any pending recipe changes at this point) #The Foldit recipe editor displays a clean screen #Follow steps 5-9 of the update procedure above Exporting an existing recipe To change an existing recipe, open the recipe in the Foldit recipe editor, then use "Save As" and "Export" to save the recipe source code in a file. Edit recipe In the Foldit cookbook, highlight an existing recipe, for example "TvdL Enhanced DRW 2.4.1". Click on the notepad icon to edit the recipe. Save As The Foldit recipe editor opens and displays the recipe. Select "Save As" from the toolbar. Export On the "Save As" dialog, select "Export". (This dialog doesn't have a title bar, so you won't see "Save As" at the top.) Create External file As OS-specific "Save As" dialog such as the one shown here should appear. Select a folder/directory for the file, and give the file a name. Use the suffix ".lua" to indicate the file is a LUA source file. Click "Save" to save the file to the specified location. Editing the recipe After exporting the recipe, a suitable editor can be used to make changes. The "vim" editor is used in these examples. As a suggested first step, locate the version number in the recipe. Consider adding a version number if there isn't one already. The "TvdL Enhanced DRW 2.4.1" prints the version number in several spots. After changing the version number, save the recipe under a new name. Alternately, copy the original recipe to a new file before editing. Importing the modified recipe The modified recipe can be imported using the Foldit recipe editor. For changes to an existing recipe, first save the existing recipe with a new name, then import the modified recipe and save this version under the new name. Saving the existing recipe under a new name first preserves the parent/child relationships of the recipe when the new version is shared in Foldit. For new recipes, simply select "New (Script V2)" in the Foldit recipe editor and import the recipe as outlined below. When the new recipe is shared in Foldit, it won't have a parent recipe. Save As Open the existing recipe again in the Foldit recipe editor, and click "Save As". This time, the goal is to give the recipe a new name in Foldit instead of exporting it. Modify recipe info In the "Save As" dialog, modify the recipe title and description. Click "OK". The original recipe has now been saved with a new name. This step ensures the original recipe will be the parent of the new version when the new version is shared in Foldit. Load In the Foldit recipe editor, with the renamed recipe still open, click the "Load" button on the toolbar. Import In the Load dialog, click "Import". Open file After clicking "Import", an OS-specific open file dialog is displayed. Select the modified recipe file. Save Verify the correct version was imported. In this example, the modified recipe version was the only change. Click "Save" to save the new version to the Foldit cookbook. New version displayed in cookbook The new version of the recipe appears in the Foldit cookbook. Hovering over the recipe displays the modified description. Category:Script tutorial Category:Windows Category:Recipes